home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2001 Haziran / CHIP Haziran2001.iso / prog / share / 16 / setup.exe / %AppDir% / AddIns / HideOnClick.ext < prev   
Encoding:
Text File  |  2001-04-24  |  18.4 KB  |  643 lines

  1. This AddIn will change the default behavior of the menus, so they hide only when the document is clicked.
  2.  
  3. NOTE: This AddIn may not work with frames support turned on.
  4.  
  5. Developed by Xavier Flix
  6.  
  7. ***
  8. //COPYRIGHT
  9.     
  10.     var nStyle = new Array;
  11.     var hStyle = new Array;
  12.     var nLayer = new Array;
  13.     var hLayer = new Array;
  14.     var nTCode = new Array;
  15.     
  16.     var AnimStep = 0;
  17.     var AnimHnd = 0;
  18.     var HTHnd = new Array;
  19.     var DoFormsTweak = true;
  20.     
  21.     var mFrame;
  22.     var cFrame;
  23.     
  24.     var OpenMenus = new Array;
  25.     var SelCommand;
  26.     var nOM = 0;
  27.     
  28.     var mX;
  29.     var mY;
  30.     var xOff = 0;
  31.     
  32.     var HideSpeed = 300;
  33.     
  34. //BROWSERDETECTION
  35.     
  36.     if((!IsWin&&IE)||SM) {
  37.     frames.self = window;
  38.     frames.top = top;
  39.     }
  40.     
  41.     if(IE)
  42.     xOff = (SM&&!OP)?-9:2;
  43. //CODEFRAME
  44.     
  45. //FX
  46.     
  47. //STYLECODE
  48.  
  49.     function GetCurCmd(e) {
  50.         //IE
  51.         //This function will return the current command under the mouse pointer. It will return null if the mouse is not over any command.
  52.         //------------------------------
  53.         //Version 1.3
  54.         //
  55.         if(SM)
  56.             var cc = e;
  57.         else
  58.             var cc = mFrame.window.event.srcElement;
  59.         while(cc.id=="") {
  60.             cc = cc.parentElement;
  61.             if(cc==null)
  62.                 break;
  63.         }
  64.         return cc;
  65.     }
  66.  
  67.     function HoverSel(mode, imgLName, imgRName, e) {
  68.         //IE
  69.         //This is the function called every time the mouse pointer is moved over or away from a command.
  70.         //------------------------------
  71.         //mode: 0 if the mouse is moving over the command and 1 if is moving away
  72.         //imgName: Name of the image object, if any, used in the selected command
  73.         //------------------------------
  74.         //Version 8.0
  75.         //
  76.         var imgL = new Image;
  77.         var imgLRsc = new Image;
  78.         var imgR = new Image;
  79.         var imgRRsc = new Image;
  80.         var nStyle;
  81.         var mc;
  82.         
  83.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  84.             HoverSel(1);
  85.         
  86.         if(imgLName!="_")
  87.             var imgL = eval("mFrame.document.images['"+imgLName+"']");
  88.         if(imgRName!="_")
  89.             var imgR = eval("mFrame.document.images['"+imgRName+"']");
  90.         
  91.         if(mode==0) {
  92.             mc = GetCurCmd(e);
  93.             if(nOM>1)
  94.                 if(mc==OpenMenus[nOM-1].SelCommand)
  95.                     return false;
  96.             if(OpenMenus[nOM].SelCommand || nOM>1)
  97.                 while(!InMenu()&&nOM>1)
  98.                     Hide();
  99.             if(imgLName!='_') imgLRsc = eval(imgLName+"On");
  100.             if(imgRName!='_') imgRRsc = eval(imgRName+"On");
  101.             OpenMenus[nOM].SelCommand = mc;
  102.             OpenMenus[nOM].SelCommandPar = [imgLName,imgRName,SM?mc.getAttribute("style"):mc.style.cssText];
  103.             if(SM)
  104.                 mc.setAttribute("style", GetCStyle(mc.style) + hStyle[mc.id]);
  105.             else
  106.                 mc.style.cssText = GetCStyle(mc.style) + hStyle[mc.id];
  107.         } else {
  108.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  109.             imgLName = (mode==1)?OpenMenus[nOM].SelCommandPar[0]:OpenMenus[nOM].OpenerPar[0];
  110.             imgRName = (mode==1)?OpenMenus[nOM].SelCommandPar[1]:OpenMenus[nOM].OpenerPar[1];
  111.             nStyle = (mode==1)?OpenMenus[nOM].SelCommandPar[2]:OpenMenus[nOM].OpenerPar[2];
  112.             mc.style.background = "";
  113.             if(SM)
  114.                 mc.setAttribute("style", nStyle);
  115.             else
  116.                 mc.style.cssText = nStyle;
  117.             if(imgLName!='_') imgLRsc = eval(imgLName+"Off");
  118.             if(imgRName!='_') imgRRsc = eval(imgRName+"Off");
  119.             window.status = "";
  120.             OpenMenus[nOM].SelCommand = null;            
  121.         }
  122.         
  123.         if(imgLName!='_') {
  124.             imgL = eval("mFrame.document.images."+imgLName);
  125.             imgL.src = imgLRsc.src;
  126.         }
  127.         if(imgRName!='_') {
  128.             imgR = eval("mFrame.document.images."+imgRName);
  129.             imgR.src = imgRRsc.src;
  130.         }
  131.         
  132.         return true;
  133.     }
  134.  
  135.     function NSHoverSel(mode, mc, bcolor) {
  136.         //NS
  137.         //This is the function called every time the mouse pointer is moved over or away from a command.
  138.         //------------------------------
  139.         //mc: Name of the layer that corresponds to the selected command
  140.         //mode: 0 if the mouse is moving over the command and 1 if is moving away
  141.         //n: Unique ID that identifies this command. Used to retrieve the data from the nLayer or hLayer array.
  142.         //bcolor: Background color of the command. Ignored if the group uses a background image.
  143.         //w: Width of the command's layer.
  144.         //h: Height of the command's layer.
  145.         //------------------------------
  146.         //Version 10.0
  147.         //
  148.         var n;
  149.         var LayerHTM;
  150.         
  151.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  152.         if(!nOM) return false;
  153.         
  154.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  155.             NSHoverSel(1);
  156.         
  157.         if(mode==0) {
  158.             mc = mc.parentLayer.layers[mc.name.substr(0, mc.name.indexOf("EH"))];
  159.             n = CBparseInt(mc.name.substr(2));
  160.             if(nOM>1)
  161.                 if(mc==OpenMenus[nOM-1].SelCommand)
  162.                     return false;
  163.             while(!InMenu()&&nOM>1)
  164.                 Hide();
  165.             LayerHTM = hLayer[n];
  166.             OpenMenus[nOM].SelCommand = mc;
  167.             OpenMenus[nOM].SelCommandPar = mc.bgColor;
  168.             mc.bgColor = bcolor;
  169.         } else {
  170.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  171.             bcolor = (mode==1)?OpenMenus[nOM].SelCommandPar:OpenMenus[nOM].OpenerPar;
  172.             n = CBparseInt(mc.name.substr(2));
  173.             LayerHTM = nLayer[n];
  174.             if(mc.parentLayer.background.src!="")
  175.                 mc.bgColor = null;
  176.             else
  177.                 mc.bgColor = bcolor;
  178.             window.status = "";
  179.             OpenMenus[nOM].SelCommand = null;
  180.         }
  181.         mc.clip.width = mc.parentLayer.parentLayer.clip.width - 2*mc.parentLayer.left;
  182.         mc.document.open();
  183.         mc.document.write(LayerHTM);
  184.         mc.document.close();
  185.         
  186.         return true;
  187.     }
  188.  
  189.     function Hide() {
  190.         //IE,NS
  191.         //This function hides the group identified by the menuId parameter.
  192.         //It also resets the values of the CurMenu and ParentMenu variables to reflect the changes of the hidden menu.
  193.         //------------------------------
  194.         //menuId: Name of the group's <div> or <layer> to be hidden.
  195.         //------------------------------
  196.         //Version 2.1
  197.         //
  198.         window.clearTimeout(HTHnd[nOM]);HTHnd[nOM] = 0;
  199.         window.clearTimeout(AnimHnd);AnimHnd = 0;
  200.         
  201.         if(OpenMenus[nOM].SelCommand!=null) {
  202.             if(IE) HoverSel(1);
  203.             if(NS) NSHoverSel(1);
  204.         }
  205.         if(OpenMenus[nOM].Opener!=null) {
  206.             if(IE) HoverSel(3);
  207.             if(NS) NSHoverSel(3);
  208.         }
  209.         
  210.         OpenMenus[nOM].visibility = "hidden";
  211.         nOM--;
  212.         
  213.         if(nOM>0)
  214.             if(!InMenu())
  215.                 HTHnd[nOM] = window.setTimeout("Hide()", HideSpeed/4);
  216.         
  217.         if(nOM==0)
  218.             FormsTweak("visible");
  219.     }
  220.  
  221.     function ShowMenu(mName, x, y, isCascading) {
  222.         //IE,NS
  223.         //This is the main function to show the menus when a hotspot is triggered or a cascading command is activated.
  224.         //------------------------------
  225.         //menuId: Name of the <div> or <layer> to be shown.
  226.         //x: Left position of the menu.
  227.         //y: Top position of the menu.
  228.         //isCascading: True if the menu has been triggered from a command, and not from a hotspot.
  229.         //------------------------------
  230.         //Version 12.9
  231.         //        
  232.         //(as) {
  233.         //indow.clearTimeout(as);
  234.         //s = 0;
  235.         //
  236.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  237.         x = CBparseInt(x);y = CBparseInt(y);
  238.         
  239.         if(AnimHnd && nOM>0) {
  240.             AnimStep=101;
  241.             Animate();
  242.         }
  243.         if(IE)
  244.             if(SM)
  245.                 var Menu = mFrame.document.getElementById(mName);
  246.             else
  247.                 var Menu = mFrame.document.all[mName];
  248.         if(NS)
  249.             var Menu = mFrame.document.layers[mName];
  250.         if(!Menu)
  251.             return false;
  252.         if(IE)
  253.             Menu = Menu.style;
  254.         if(Menu==OpenMenus[nOM])
  255.             return false;
  256.             
  257.         if(!isCascading)
  258.             HideAll();
  259.             
  260.         Menu.Opener = nOM>0?OpenMenus[nOM].SelCommand:null;
  261.         Menu.OpenerPar = nOM>0?OpenMenus[nOM].SelCommandPar:null;
  262.         Menu.SelCommand = null;
  263.         if(OP) {
  264.             Menu.width = Menu.pixelWidth;
  265.             Menu.height = Menu.pixelHeight;
  266.         }
  267.         
  268.         var pW = GetWidthHeight()[0] + GetLeftTop()[0];
  269.         var pH = GetWidthHeight()[1] + GetLeftTop()[1];
  270.         
  271.         if(IE) {
  272.             if(isCascading) {
  273.                 x = CBparseInt(OpenMenus[nOM].left) + CBparseInt(OpenMenus[nOM].width) - 6;
  274.                 y = CBparseInt(OpenMenus[nOM].SelCommand.style.top) + CBparseInt(OpenMenus[nOM].top) - y;
  275.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?CBparseInt(OpenMenus[nOM].left) - CBparseInt(Menu.width) + 6:x;
  276.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  277.             } else {
  278.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?pW - CBparseInt(Menu.width):x;
  279.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  280.             }
  281.             if(IsWin&&!SM)
  282.                 Menu.clip = "rect(0 0 0 0)";
  283.         }
  284.         if(NS) {
  285.             if(isCascading) {
  286.                 x = OpenMenus[nOM].left + OpenMenus[nOM].clip.width - 6;
  287.                 y = OpenMenus[nOM].top + OpenMenus[nOM].SelCommand.top;
  288.                 x = (x+Menu.w>pW)?OpenMenus[nOM].left - Menu.w + 6:x;
  289.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  290.             } else {
  291.                 x = (x+Menu.w>pW)?pW - Menu.w:x;
  292.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  293.             }
  294.             Menu.clip.width = 0;
  295.             Menu.clip.height = 0;
  296.             Menu.moveToAbsolute(x,y);
  297.         }
  298.         if(isCascading)
  299.             Menu.zIndex = CBparseInt(OpenMenus[nOM].zIndex) + 1;
  300.         Menu.visibility = "visible";
  301.         OpenMenus[++nOM] = Menu;
  302.         HTHnd[nOM] = 0;
  303.         if((IE&&IsWin&&!SM)||NS)
  304.             AnimHnd = window.setTimeout("Animate()", 10);
  305.         FormsTweak("hidden");
  306.         
  307.         return true;
  308.     }
  309.  
  310.     function Animate() {
  311.         //IE,NS
  312.         //This function is called by ShowMenu every time a new group must be displayed and produces the predefined unfolding effect.
  313.         //Currently is disabled for Navigator, because of some weird bugs we found with the clip property of the layers.
  314.         //------------------------------
  315.         //menuId: Name of the <div> or <layer> to be animated.
  316.         //------------------------------
  317.         //Version 1.3
  318.         //
  319.         var r = '';
  320.         var nw = nh = 0;
  321.         switch(fx) {
  322.             case 1:
  323.                 if(IE) r = "0 " + AnimStep + "% " + AnimStep + "% 0";
  324.                 if(NS) nw = AnimStep; nh = AnimStep;
  325.                 break;
  326.             case 2:
  327.                 if(IE) r = "0 100% " + AnimStep + "% 0";
  328.                 if(NS) nw = 100; nh = AnimStep;
  329.                 break;
  330.             case 3:
  331.                 if(IE) r = "0 " + AnimStep + "% 100% 0";
  332.                 if(NS) nw = AnimStep; nh = 100;
  333.                 break;
  334.             case 0:
  335.                 if(IE) r = "0 100% 100% 0";
  336.                 if(NS) nw = 100; nh = 100;
  337.                 break;
  338.         }
  339.         if(OpenMenus[nOM]) {
  340.             with(OpenMenus[nOM]) {
  341.                 if(IE)
  342.                     clip =  "rect(" + r + ")";
  343.                 if(NS) {
  344.                     clip.width = w*(nw/100);
  345.                     clip.height = h*(nh/100);
  346.                 }
  347.             }
  348.             AnimStep += 20;
  349.             if(AnimStep<=100)
  350.                 AnimHnd = window.setTimeout("Animate()",25);
  351.             else {
  352.                 window.clearTimeout(AnimHnd);
  353.                 AnimStep = 0;
  354.                 AnimHnd = 0;
  355.             }
  356.         }
  357.     }
  358.  
  359.     function InMenu() {
  360.         //IE,NS
  361.         //This function returns true if the mouse pointer is over a group.
  362.         //------------------------------
  363.         //mX: Current X position of the mouse pointer.
  364.         //mY: Current Y position of the mouse pointer.
  365.         //m: <div> or <layer> object to be tested.
  366.         //------------------------------
  367.         //Version 1.2
  368.         //
  369.         var m = OpenMenus[nOM];
  370.         if(!m)
  371.             return false;
  372.         if(IE&&!SM)
  373.             SetPointerPos();            
  374.         var l = CBparseInt(m.left) + xOff;
  375.         var r = l+(IE?CBparseInt(m.width):m.clip.width) - xOff;
  376.         var t = CBparseInt(m.top) + xOff;
  377.         var b = t+(IE?CBparseInt(m.height):m.clip.height) - xOff;
  378.         return ((mX>=l && mX<=r) && (mY>=t && mY<=b));
  379.     }
  380.  
  381.     function SetPointerPos(e) {
  382.         //IE,NS
  383.         //This function sets the mX and mY variables with the current position of the mouse pointer.
  384.         //------------------------------
  385.         //e: Only used under Navigator, corresponds to the Event object.
  386.         //------------------------------
  387.         //Version 1.0
  388.         //
  389.         if(IE) {
  390.             if(!SM) {
  391.                 if(mFrame!=cFrame||event==null)
  392.                     if(mFrame.window.event==null)
  393.                         return;
  394.                     else
  395.                         e = mFrame.window.event;
  396.                 else
  397.                     e = event;
  398.             }
  399.             mX = e.clientX + GetLeftTop()[0];
  400.             mY = e.clientY + GetLeftTop()[1];
  401.         }
  402.         if(NS) {
  403.             mX = e.pageX;
  404.             mY = e.pageY;
  405.         }
  406.     }
  407.  
  408.     function HideMenus(e) {
  409.         //IE,NS
  410.         //This function checks if the mouse pointer is on a valid position and if the current menu should be kept visible.
  411.         //The function is called every time the mouse pointer is moved over the document area.
  412.         //------------------------------
  413.         //e: Only used under Navigator, corresponds to the Event object.
  414.         //------------------------------
  415.         //Version 25.0
  416.         //
  417.         if(nOM>0) {
  418.             SetPointerPos(e);
  419.             if(OpenMenus[nOM].SelCommand!=null)
  420.                 if(!InMenu()&&!HTHnd[nOM])
  421.                     HTHnd[nOM] = window.setTimeout("if(nOM>0)if(!InMenu())Hide()", HideSpeed);
  422.         }
  423.     }
  424.  
  425.     function FormsTweak(state) {
  426.         //IE
  427.         //This is an undocumented function, which can be used to hide every form element on a page.
  428.         //This can be useful if the menus will be displayed over an area where is a combo box, which is an element that cannot be placed behind the menus and it will always appear over the menus resulting in a very undesirable effect.
  429.         //------------------------------
  430.         //Version 1.0
  431.         //
  432.         if(DoFormsTweak && IE)
  433.             for(var f = 0; f <= (mFrame.document.forms.length - 1); f++)
  434.                 for(var e = 0; e <= (mFrame.document.forms[f].elements.length - 1); e++)
  435.                     if(mFrame.document.forms[f].elements[e].type=="select-one")
  436.                         mFrame.document.forms[f].elements[e].style.visibility = state;
  437.     }
  438.  
  439.     function execURL(url, tframe) {
  440.         //IE,NS
  441.         //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  442.         //------------------------------
  443.         //url: Encrypted URL that must be opened or executed.
  444.         //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  445.         //------------------------------
  446.         //Version 1.0
  447.         //
  448.         window.setTimeout("execURL2('" + url + "', '" + tframe + "')", 100);
  449.     }
  450.  
  451.     function execURL2(url, tframe) {
  452.         //IE,NS
  453.         //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  454.         //------------------------------
  455.         //url: Encrypted URL that must be opened or executed.
  456.         //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  457.         //------------------------------
  458.         //Version 1.0
  459.         //
  460.         var fObj = eval(rStr(tframe));
  461.         url = rStr(url);
  462.         url.indexOf("javascript")!=url.indexOf("vbscript")?eval(url):fObj.location.href = url;
  463.     }
  464.  
  465.     function rStr(s) {
  466.         //IE,NS
  467.         //This function is used to decrypt the URL parameter from the triggered command.
  468.         //------------------------------
  469.         //Version 1.1
  470.         //
  471.         s = xrep(s,"\x1E","'");
  472.         s = xrep(s,"\x1D","\x22");
  473.         s = xrep(s,"\x1C",",");
  474.         return s;
  475.     }
  476.  
  477.     function xrep(s, f, n) {
  478.         //IE,NS
  479.         //This function looks for any occurrence of the f string and replaces it with the n string.
  480.         //------------------------------
  481.         //Version 1.0
  482.         //
  483.         var tmp = s.split(f);
  484.         return tmp.join(n);
  485.     }
  486.  
  487.     function hNSCClick(e) {
  488.         //NS
  489.         //This function executes the selected command's trigger code.
  490.         //------------------------------
  491.         //Version 1.0
  492.         //
  493.         eval(this.TCode);
  494.     }
  495.  
  496.     function CBparseInt(n) {
  497.         //NS
  498.         //his function fixes a bug in Navigator's parseInt() function for the Mac.
  499.         //-----------------------------
  500.         //ersion 1.0
  501.         //
  502.         if(typeof(n)=="number"||typeof(n)=="string")
  503.             return (!IsWin&&!SM?n:parseInt(n))*1;
  504.         return 0;
  505.     }
  506.  
  507.     function HideAll() {
  508.         //IE,NS
  509.         //This function will hide all the currently opened menus.
  510.         //------------------------------
  511.         //Version 1.0
  512.         //
  513.         while(nOM>0)
  514.             Hide();
  515.     }
  516.  
  517.     function GetLeftTop() {
  518.         //IE,NS
  519.         //This function returns the scroll bars position on the menus frame.
  520.         //------------------------------
  521.         //Version 1.0
  522.         //
  523.         if(IE)
  524.             return [OP?0:SM?mFrame.scrollX:mFrame.document.body.scrollLeft,OP?0:SM?mFrame.scrollY:mFrame.document.body.scrollTop];
  525.         if(NS)
  526.             return [mFrame.pageXOffset,mFrame.pageYOffset];
  527.     }
  528.  
  529.     function tHideAll() {
  530.         //IE,NS
  531.         //This function is called when the mouse is moved away from a hotspot to close any opened menu.
  532.         //------------------------------
  533.         //Version 1.0
  534.         //
  535.         HTHnd[nOM] = window.setTimeout("if(!InMenu()&&nOM==1)HideAll(); else HTHnd[nOM]=0;", HideSpeed);
  536.     }
  537.  
  538.     function GetWidthHeight() {
  539.         //IE,NS
  540.         //This function returns the width and height of the menus frame.
  541.         //------------------------------
  542.         //Version 1.0
  543.         //
  544.         if(IE&&!SM)
  545.             return [mFrame.document.body.clientWidth,mFrame.document.body.clientHeight];
  546.         if(NS||SM)
  547.             return [mFrame.innerWidth,mFrame.innerHeight];
  548.     }
  549.  
  550.     function GetCStyle(cmc) {
  551.         //IE,SM
  552.         //This functions completes the style of command with all the common
  553.         //parameters from the original style code.
  554.         //------------------------------
  555.         //Version 1.0
  556.         //
  557.         return "position: absolute; left:" + cmc.left + 
  558.                "; top: " + cmc.top + 
  559.                "; width: " + (OP?cmc.pixelWidth:cmc.width) + 
  560.                "; height: " + (OP?cmc.pixelHeight:cmc.height) + "; ";
  561.     }
  562.  
  563.     function SetUpEvents() {
  564.         //IE,NS
  565.         //This function initializes the frame variables and setups the event handling.
  566.         //------------------------------
  567.         //Version 1.0
  568.         //
  569.         onerror = errHandler;
  570.         if(typeof(mFrame)=="undefined")
  571.         //MENUFRAME
  572.         if(typeof(mFrame)=="undefined")
  573.             window.setTimeout("SetUpEvents()",10);
  574.         else {
  575.             if(NS) {
  576.                 mFrame.captureEvents(Event.MOUSEMOVE);
  577.                 mFrame.onmousemove = HideMenus;
  578.                 mFrame.window.captureEvents(Event.MOUSEUP);
  579.                 mFrame.window.onmouseup = NSHideAll;
  580.                 PrepareEvents();
  581.             }
  582.             if(IE) {
  583.                 document.onmousemove = HideMenus;
  584.                 document.onclick = function(){if(nOM>0) if(!InMenu()) HTHnd[nOM] = window.setTimeout("HideAll()", HideSpeed*2);};
  585.                 mFrame.document.onmousemove = document.onmousemove;
  586.                 mFrame.document.onclick = document.onclick;
  587.             }
  588.         }
  589.     }
  590.  
  591.     function errHandler(sMsg,sUrl,sLine) {
  592.         //E,NS
  593.         //his function will trap any errors generated by the scripts and filter the unhandled ones.
  594.         //-----------------------------
  595.         //ersion 1.0
  596.         //
  597.         if(sMsg.substr(0,16)!="Access is denied"&&sMsg!="Permission denied")
  598.             alert("DHTML Menu Builder Java Script Error\n" +
  599.                   "\nDescription: " + sMsg +
  600.                   "\nSource: " + sUrl +
  601.                   "\nLine: "+sLine);
  602.         return true;
  603.     }
  604.  
  605.     function PrepareEvents() {
  606.         //NS
  607.         //This function is called right after the menus are rendered.
  608.         //It has been designed to attach the OnClick event to the <layer> tag. This is being
  609.         //done this way because Navigator does not support inline event capturing on the
  610.         //click event in the layer tag... duh!
  611.         //------------------------------
  612.         //Version 2.0
  613.         //
  614.         for(var l=0; l<mFrame.document.layers.length; l++) {
  615.             var lo = mFrame.document.layers[l];
  616.             if(lo.layers.length) {
  617.                 lo.w = lo.clip.width;
  618.                 lo.h = lo.clip.height;
  619.                 for(var sl=0; sl<lo.layers[0].layers.length; sl++) {
  620.                     var slo = mFrame.document.layers[l].layers[0].layers[sl];
  621.                     if(slo.name.indexOf("EH")>0) {
  622.                         slo.document.onmouseup = hNSCClick;
  623.                         slo.document.TCode = nTCode[slo.name.split("EH")[1]];
  624.                     }                    
  625.                 }
  626.             }
  627.         }
  628.     }
  629.  
  630.     function NSHideAll(e) {
  631.         //,NS
  632.         //
  633.         //
  634.         if(!(nOM>0?OpenMenus[nOM].SelCommand:null))
  635.             HideAll();
  636.         else
  637.             routeEvent(e);
  638.     }
  639.  
  640. //BROWSERCODE
  641. //EXPAND
  642.  
  643.